from django.db import models
from houduan.utils.basemodels import BaseModel
# Create your models here.





class LunZhuan(BaseModel):
    """支付信息"""
    imageUrl = models.ImageField(verbose_name='存放地点')
    isDeleted = models.IntegerField(verbose_name='删除',default=0)
    linkUrl = models.ImageField(verbose_name='连接地址')
    sort = models.IntegerField(verbose_name='排序除')
    title = models.CharField(max_length=10, verbose_name='标题')

    class Meta:
        db_table = 't_lun_zhuan'
        verbose_name = '入场二维码'
        verbose_name_plural = verbose_name





class ShopChannel(BaseModel):
    """商品频道"""

    imageUrl = models.ImageField(verbose_name='存放地点')
    name = models.CharField(max_length = 10,verbose_name='分类名称')

    class Meta:
        db_table = 't_shop_channel'
        verbose_name = '商品频道'
        verbose_name_plural = verbose_name


class ShopCategory(BaseModel):
    """新闻类别"""
    imageUrl = models.ImageField(verbose_name='存放地点')
    name = models.CharField( max_length = 10,verbose_name='分类名称')
    channel = models.ForeignKey(ShopChannel,on_delete=models.PROTECT)


    class Meta:
        db_table = 't_shops_category'
        verbose_name = '新闻类别'
        verbose_name_plural = verbose_name


class Shop(BaseModel):
    """文章"""
    applyUser = models.CharField(max_length = 100,verbose_name='对应用户')
    category1Id = models.ForeignKey(ShopChannel ,on_delete=models.PROTECT, verbose_name='频道大类')
    category2Id = models.ForeignKey(ShopCategory,on_delete=models.PROTECT, verbose_name='分类小类')
    detailList = models.CharField(max_length = 100, verbose_name='删除列表')
    floralLanguage = models.TextField(verbose_name='文章内容')
    imageUrl = models.ImageField(verbose_name='存放地点')
    isDeleted = models.IntegerField( verbose_name='是否删除',default=0)
    isRecommend = models.IntegerField(verbose_name='是否推荐',default=1)
    marketPrice = models.DecimalField(max_digits=11, decimal_places=2, verbose_name="商品订单金额")
    material = models.CharField(max_length = 10, verbose_name='材料')
    name = models.CharField(max_length = 10, verbose_name='商品名称')
    packing = models.CharField(max_length = 10, verbose_name='包装')
    price = models.DecimalField(max_digits=10,decimal_places=2,verbose_name="联系人")
    saleCount = models.IntegerField(verbose_name='销售量')
    stockCount = models.IntegerField(verbose_name='存货')

    class Meta:
        db_table = 't_shop'
        verbose_name = '文章'
        verbose_name_plural = verbose_name


class Active(BaseModel):
    """三个图标"""
    category2Id = models.ForeignKey(ShopCategory, on_delete=models.PROTECT, verbose_name='分类小类')
    imageUrl = models.ImageField(verbose_name='存放地点')

    class Meta:
        db_table = 't_active'
        verbose_name = '入场二维码'
        verbose_name_plural = verbose_name

